home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 45
/
Aminet 45 (2001)(GTI - Schatztruhe)[!][Oct 2001].iso
/
Aminet
/
game
/
role
/
ldmud-3.2-bin.lha
/
mud
/
doc
/
efun
/
filter_array
< prev
next >
Wrap
Text File
|
2001-04-06
|
2KB
|
51 lines
OBSOLETE
SYNOPSIS
mixed *filter_array(mixed *arr, string fun, string|object ob,
mixed extra, ...)
mixed *filter_array(mixed *arr, closure cl, mixed extra, ...)
mixed *filter_array(mixed *arr, mapping map, mixed extra, ...)
DESCRIPTION
Returns an array holding the items of arr filtered through
ob->fun(element, extra, ...), the closure cl, or the mapping map.
The function 'fun' in 'ob' resp. the closure 'cl' is called
for each element in arr with that element as parameter. The
extra and following parameters are in each call if given.
The mapping 'map' is likewise indexed by each element.
If ob->fun(arr[index], extra) returns != 0 resp.
map[arr[index]] exists, the element is included in the
returned array.
If arr is not an array, an error occurs.
The extra argument(s) are optional and must not be protected
references like &(i[0]).
If <ob> is omitted, or neither a string nor an object, it
defaults to this_object().
Since 3.2.1@36, the second arg can also be a mapping. Then
only the elements of the array which belong to the map (as
keys) will be returned (i.e. map[arr[index]] != 0).
EXAMPLE
int check_if_idle(object user) { return query_idle(user); }
...
object *idle_users;
idle_users = filter_array(users(), "check_if_idle");
/* equivalent but smaller and faster */
idle_users = filter_array(users(), #'query_idle );
Now idle_users contains all users that have been idle for more
than 1 second.
HISTORY
Since LDMud 3.2.6 obsoleted by efun filter().
Since LDMud 3.2.9, not available if driver is compiled without
USE_DEPRECATED.
SEE ALSO
filter(E), filter_objects(E), map(E), map_objects(E)